import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;


public class FileIO {
	private Map<String,ArrayList<String>> a;
	

	public FileIO(String s){
		Scanner inputScanner = null;
		
		a = new HashMap<String,ArrayList<String>>();
		
		try {
			inputScanner = new Scanner(new FileInputStream(s));

		}
		catch(FileNotFoundException e){System.out.println(e);System.exit(1);}
		
		for (int i = 1;i < 27;i++){
			switch(i){
			case(1) : a.put("a", new ArrayList<String>(10));
			case(2) : a.put("b", new ArrayList<String>(10));
			case(3) : a.put("c", new ArrayList<String>(10));
			case(4) : a.put("d", new ArrayList<String>(10));
			case(5) : a.put("e", new ArrayList<String>(10));
			case(6) : a.put("f", new ArrayList<String>(10));
			case(7) : a.put("g", new ArrayList<String>(10));
			case(8) : a.put("h", new ArrayList<String>(10));
			case(9) : a.put("i", new ArrayList<String>(10));
			case(10) : a.put("j", new ArrayList<String>(10));
			case(11) : a.put("k", new ArrayList<String>(10));
			case(12) : a.put("l", new ArrayList<String>(10));
			case(13) : a.put("m", new ArrayList<String>(10));
			case(14) : a.put("n", new ArrayList<String>(10));
			case(15) : a.put("o", new ArrayList<String>(10));
			case(16) : a.put("p", new ArrayList<String>(10));
			case(17) : a.put("q", new ArrayList<String>(10));
			case(18) : a.put("r", new ArrayList<String>(10));
			case(19) : a.put("s", new ArrayList<String>(10));
			case(20) : a.put("t", new ArrayList<String>(10));
			case(21) : a.put("u", new ArrayList<String>(10));
			case(22) : a.put("v", new ArrayList<String>(10));
			case(23) : a.put("w", new ArrayList<String>(10));
			case(24) : a.put("x", new ArrayList<String>(10));
			case(25) : a.put("y", new ArrayList<String>(10));
			case(26) : a.put("z", new ArrayList<String>(10));
			}
		}
		
		fillDictionary(inputScanner);
		
	}
	
private void fillDictionary(Scanner inputScanner){
	while (inputScanner.hasNext() == true){
	String s = inputScanner.next();
	System.out.println(s);
	String tempString = s.substring(0, 1);
	ArrayList<String> temp = a.get(tempString);
	temp.add(s);
	a.put(tempString, temp);
	
	}
	
}

public Map<String, ArrayList<String>> getA() {
	return a;
}

}
